//
//  XVMainViewController.swift
//  Hunter
//
//  Created by oher on 15/6/24.
//  Copyright © 2015年 刘🐑. All rights reserved.
//

import UIKit

class XVMainViewController: UITabBarController {

    override func viewDidLoad() {
        let bar = XVTabBar()
        //精华语句
        setValue(bar, forKeyPath: "tabBar")
        
        super.viewDidLoad()
        addChildViewControllers()

    }
    
    ///统一添加子控制器
    func addChildViewControllers() {
        addChild(DiscoveryTableViewController(), pic: "btn_home_found", title: "发现")
        addChild(PositionTableViewController(), pic: "btn_home_job" ,title : "")
        addChild(MessageTableViewController(), pic: "btn_home_message" ,title :"消息")
        addChild(CircleTableViewController(), pic: "btn_home_connection" ,title: "")
        addChild(ProfileTableViewController(), pic: "btn_home_mine" ,title: "我")
    }
    
    ///添加控制器
    func addChild(vc: UIViewController, pic: String, title: String){
        //导航栏中间文字等设置
        vc.navigationItem.title = title
        let navVC = UINavigationController(rootViewController:vc)
        navVC.tabBarItem.selectedImage = UIImage(named: pic + "_selected")
        navVC.tabBarItem.image = UIImage(named: pic)
        
        addChildViewController(navVC)
        
    }

    

}
